//
//  CLHCollectionSectionFooterView.m
//  ListViewModel_Example
//
//  Created by 曹连华 on 2019/7/31.
//  Copyright © 2019 clh2046@163.com. All rights reserved.
//

#import "CLHCollectionSectionFooterView.h"
#import <Masonry/Masonry.h>
@interface CLHCollectionSectionFooterView ()

@property (nonatomic, strong) UILabel *mainTitleLabel;
@property (nonatomic, strong) UILabel *subLabel;

@end

@implementation CLHCollectionSectionFooterView

- (UILabel *)mainTitleLabel {
    if (!_mainTitleLabel) {
        _mainTitleLabel = [[UILabel alloc]init];
        _mainTitleLabel.textColor = [UIColor redColor];
        _mainTitleLabel.font = [UIFont systemFontOfSize:14];
    }
    return _mainTitleLabel;
}

- (UILabel *)subLabel {
    if (!_subLabel) {
        _subLabel = [[UILabel alloc]init];
        _subLabel.textColor = [UIColor darkGrayColor];
        _subLabel.font = [UIFont systemFontOfSize:12];
    }
    return _subLabel;
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self initUI];
    }
    return self;
}

- (void)initUI {
    self.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self addSubview:self.mainTitleLabel];
    [self addSubview:self.subLabel];
    
    [self.mainTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(0);
        make.top.bottom.mas_equalTo(0);
    }];
    
    [self.subLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mainTitleLabel.mas_right).mas_equalTo(5);
        make.trailing.mas_equalTo(0);
        make.top.bottom.mas_equalTo(0);
    }];
    
}

- (void)updateMainTitle:(NSString *)mainTitle subTitle:(NSString *)subTitle  {
    self.mainTitleLabel.text = mainTitle;
    self.subLabel.text = subTitle;
}

@end
